<!DOCTYPE html>
<!-- saved from url=(0037)http://127.0.0.1/wx/ybss/zhuce/zc.jsp -->
<html class="pixel-ratio-1"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

  <title>登录</title>

  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no, email=no">
  <!--[if IE]>
  <script src="http://127.0.0.1:80/wx/ybss/js/html5shiv.min.js"></script>
  <![endif]-->

  <link href="resource/style.css" rel="stylesheet" type="text/css">
  <script src="resource/jquery214js"></script>
  <script src="resource/fastclick.js"></script>
  <script src="resource/zeptomin.js"></script>
  <script src="resource/picker.js"></script>
  <script src="../script/api.js"></script>
  <script src="../script/constants.js"></script>
  <script type="text/javascript" src="../script/aes.js"></script>
  <script type="text/javascript" charset="UTF-8" src="../script/naes.js"></script>
  <script type="text/javascript" src="../script/modeecb.js"></script>
  <script src="../script/tmd5.js"></script>
  <link rel="stylesheet" href="../resource/jinsuistyle.css" />
  <script>

    var timer = null;
    var countdown=60;

    window.apiready = function(){
    if(api.systemType == "ios"){
	   document.getElementById("statusBar").style.background = "#298cb4";
	}
    $api.fixStatusBar( $api.dom('header') );
      if (api.systemType=='ios') {
        var header = $api.byId('jsheader');
        $api.fixIos7Bar(header);
      }
      var dl_phone = $api.getStorage("dl_phone");
      $("#phone").val(dl_phone);
    }

  </script>

  <style>
 
	.space2{background: #878787;}
    .space{background: #104E8B;}
    .space1{background: #cccccc;}
    .logo-license{margin-top:0px;}
    .left{font-weight:bold;}
    .info {margin-top: 5rem;}
    .btn-1 a {
    width: 90%;
    outline: none;
    border: none;
    background: #18b4ed;
    color: #fff;
    height: 5rem;
    line-height: 5rem;
    display: inline-block;
    border-radius: 0.4rem;
    font-size: 2rem;
    }

    .weui_cells_form input, .weui_cells_form label[for], .weui_cells_form textarea {
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    }
    .weui_uploader_input {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    }
    .weui_uploader_input_wrp {
    float: left;
    position: relative;
    margin-right: 9px;
    margin-bottom: 9px;
    width: 77px;
    height: 77px;
    border: 1px solid #d9d9d9;
    }
    .weui_uploader_files {
    list-style: none;
    }
    .weui_uploader_file {
    font-size: 12px;
    color: #333;
    text-align: center;
    display: table-cell;
    vertical-align: middle;
    display: table;
    }
    .weui_uploader_file {
    float: left;
    margin-right: 9px;
    margin-bottom: 9px;
    width: 79px;
    height: 79px;
    background: no-repeat 50%;
    background-size: cover;
    }

    .info ul li .weui_uploader_files{
    width:99px;
    height:99px;
    }
    .js_file1_show,.js_file2_show,.js_file3_show{display:none;}
    #ssk{background-color:#FFFFFF;width: 93%;height: 5rem;font-size:2rem;}
    /*地址样式*/
    #divselect .all li{line-height:2rem;padding:5px 1rem;text-indent:0;}
  </style>

</head>
<body style="background:url(../image/bj.png) repeat-x 0 80px;background-size:100%;">
<div style="height:600px;background:url(../image/mainbg.png) no-repeat right 0 bottom 0%;background-size:80%">
  <input name="md5_passwd" id="md5_passwd" type="hidden" />
  <input name="sm" id="sm" type="hidden" />
  <input name="type" id="type" type="hidden" value="1"/>
        <img id="banner1" src="../image/top.png" style="width: 100%;position:relative;">
  <article class="info" style="margin-top:0">


    <ul>

      <li style="border:none">
	  <div class="left" onclick="api.closeWin();" style="font-size:20px;margin-bottom: 2px" >
	  <font size="20px" color="#003399"> 返回上一页</font></div></br><br>
		<hr class="space2" style="height:2px;width:85%;margin-left:7.5%;margin-bottom:20px;border:none" />
        <div class="left">
          手机号:
        </div>
        <div class="right">
          <input id="phone" name="phone" readonly="ture" placeholder="请输入手机号" style="background-color:transparent">

        </div>
        <div class="clear"></div>
      </li>
      <hr class="space1" style="height:2px;width:85%;margin-left:7.5%;margin-top:3px;border:none" />
      <li style="border:none">
        <div class="left">
          原密码:
        </div>
        <div class="right">
          <input style="background-color:transparent" type="password" id="oldpasswd" name="oldpasswd" placeholder="请输入6位数字密码">
        </div>
        <div class="clear"></div>
      </li>
	  <hr class="space1" style="height:2px;width:85%;margin-left:7.5%;margin-top:3px;border:none" />
      <li style="border:none">
        <div class="left">
          新密码:
        </div>
        <div class="right">
          <input style="background-color:transparent" type="password" id="passwd" name="passwd" placeholder="请输入6位数字密码">
        </div>
        <div class="clear"></div>
      </li>
	  <hr class="space1" style="height:2px;width:85%;margin-left:7.5%;margin-top:3px;border:none" />
      <li style="border:none">
        <div class="left">
          确认新密码:
        </div>
        <div class="right">
          <input style="background-color:transparent" type="password" id="passwd1" name="passwd1" placeholder="请输入6位数字密码">
        </div>
        <div class="clear"></div>
      </li>
      <hr class="space1" style="height:1.5px;width:85%;margin-left:7.5%;margin-bottom:3px;border:none" />
      <li style="padding:0;border:none">
        <div class="left">
          <div style="font-size:14px;border:1px solid #ccc;background-color:#dfdfdf;">
          <input id="yzmhq" type="button" name="yzmhq" style="color:#FFFFFF;border:none;width:100%;height:50px;background-color:#104E8B" value="获取验证码" onclick="getYzm(this)">
        </div>
        </div>
        <div class="right" style="line-height:50px;">
          <input style="background-color:transparent" id="yzmtx" name="yzmtx" placeholder="输入手机验证码">
        </div>
        <div class="clear"></div>
      </li>
	  <hr class="space1" style="height:2px;width:85%;margin-left:7.5%;margin-top:3px;border:none" />
     
    </ul>
  </article>
  <article class="btn-1">


	<a onclick="sz()"  id="wzc" style="width:40%;background:#104E8B;height:40px;font-size:15px;text-align:center;line-height:4rem;margin-top:8px;text-decoration:none">确认</a>
	<a id="yzc" style="width:40%;background:#104E8B;height:40px;font-size:15px;text-align:center;line-height:4rem;margin-top:8px;text-decoration:none;display: none">数据提交中...</a>

  </article>
  
</div>
<script>
 function check0(){

   var passwd = document.getElementById("passwd").value;
   var passwd1 = document.getElementById("passwd1").value;

		if( passwd ==null||passwd=="" ){
	      alert("密码不能为空");
	       $("#wzc").show();
	       $("#yzc").hide();
	      return false;
	      
	    }
	    

	    if( passwd != passwd1 ){
	      alert("两次输入密码不同");
	       $("#wzc").show();
	       $("#yzc").hide();
	      return false;
	      
	    }
	    
	     if(!(/^\d{6}$/.test(passwd))){//验证手机号
      // alert("输入正确手机号");
		    alert("请输入6位数字密码");
		       $("#wzc").show();
		       $("#yzc").hide();
		      return false;
	    }
     return true;
    }

	function sz(){
	var a = check0();
	var oldpasswd = document.getElementById("oldpasswd").value;
	var passwd = document.getElementById("passwd").value;
    var passwd1 = document.getElementById("passwd1").value;
	var passwd = md5(passwd);
	var passwd1 = md5(passwd1);
	var yzmtx = document.getElementById("yzmtx").value;
		if(a){
	 var login = $api.getStorage("loginid");
	 var aeskey = api.loadSecureValue({
        sync: true,
        key: 'aeskey'
      });	
      var salt = api.loadSecureValue({
	       sync: true,
	       key: 'salt'
	  });
	  oldpasswd = md5(oldpasswd); 
	  oldpasswd = md5(oldpasswd+salt); 
	  var dl_phone = $api.getStorage("dl_phone");
	  passwd = md5(passwd+salt);
	  var login = $api.getStorage("loginid");
	  var content = {"id":login,"zfwp":passwd,"phone":dl_phone,"oldpwd":oldpasswd,"yzm":yzmtx};
      var callback = function(ret, err){
            //console.log(JSON.stringify(ret));
            if(ret){
			if(ret.flag=="Y"){
			   api.alert({msg:'操作成功'});
			   api.closeWin();
			}else if(ret.flag=="E"){
			    api.alert({msg:'原密码有误'});
       		 	$("#yzc").hide();
                $("#wzc").show();
			}else if(ret.flag=="W"){
			    api.alert({msg:'验证码错误'});
       		 	$("#yzc").hide();
                $("#wzc").show();
			}else{
		        api.alert({msg:'操作失败'});
       		 	$("#yzc").hide();
                $("#wzc").show();
		    }
		 }
      }
      encApiAjax(JSON.stringify(content),url.zfmm,callback);
	 }
	}
	
	
	function settime(val) {
      if (countdown == 0) {
        val.removeAttribute("disabled");
        val.value="获取验证码";
        countdown = 60;
        $("#yzm").val("");
        window.clearTimeout(timer);
      } else {
        val.setAttribute("disabled", true);
        val.value="重新发送(" + countdown + ")";
        countdown--;
        timer = setTimeout(function() {
          settime(val);
        },1000);

      }

    }
    
	
	    function getYzm(e){
      var aeskey = api.loadSecureValue({
        sync: true,
        key: 'aeskey'
      });
        if($("#phone").val()!=null||$("#phone").val()!=null){
          var phone = $("#phone").val();
          if(!(/^1[3|4|5|7|8][0-9]\d{4,8}$/.test(phone))){//验证手机号
            alert("输入正确手机号");
            return false;
          }
          settime(e);
           var ip = "0.0.0.0";
//     api.require('ipAddress').getIp(
//	   function(ret, err) {
	        var content = {"phone":phone,"ip":ip,type:"1"};
	        var callback = function(ret, err){
		            //console.log(JSON.stringify(ret));
		            if(ret.flag=="Y"){
			          alert("验证码已发送，请稍候");
			         }else if(ret.flag=="N"){
			            alert("请求验证码过于频繁，请稍后再试！");
			         }else if(ret.flag=="W"){
			            alert("账号不存在！");
			         }else {
			            alert("验证码发送失败，请重试");
			         }
		        }
		    encApiAjax(JSON.stringify(content),url.hqccode,callback);
     //   });
        }else{
          alert("请先输入手机号码")
        }
      }

</script>


</body></html>
